package com.small.nacos.config.server.model.event;


import com.small.nacos.common.notify.Event;

/**
 * 配置存储事件
 */
public class ConfigDumpEvent extends Event {

    private static final long serialVersionUID = -8776888606458370294L;

    /**
     * true是移除配置 false是保存配置
     */
    private boolean remove;

    private String namespaceId;

    private String dataId;

    private String group;

    private String content;

    private String type;

    private long lastModifiedTs;

    public boolean isRemove() {
        return remove;
    }

    public void setRemove(boolean remove) {
        this.remove = remove;
    }

    public String getNamespaceId() {
        return namespaceId;
    }

    public void setNamespaceId(String namespaceId) {
        this.namespaceId = namespaceId;
    }

    public String getDataId() {
        return dataId;
    }

    public void setDataId(String dataId) {
        this.dataId = dataId;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public long getLastModifiedTs() {
        return lastModifiedTs;
    }

    public void setLastModifiedTs(long lastModifiedTs) {
        this.lastModifiedTs = lastModifiedTs;
    }

    public static ConfigDumpEventBuilder builder() {
        return new ConfigDumpEventBuilder();
    }

    public static final class ConfigDumpEventBuilder {

        private boolean remove;

        private String namespaceId;

        private String dataId;

        private String group;

        private String content;

        private String type;

        private long lastModifiedTs;

        private ConfigDumpEventBuilder() {
        }

        public ConfigDumpEventBuilder remove(boolean remove) {
            this.remove = remove;
            return this;
        }

        public ConfigDumpEventBuilder namespaceId(String namespaceId) {
            this.namespaceId = namespaceId;
            return this;
        }

        public ConfigDumpEventBuilder dataId(String dataId) {
            this.dataId = dataId;
            return this;
        }

        public ConfigDumpEventBuilder group(String group) {
            this.group = group;
            return this;
        }

        public ConfigDumpEventBuilder content(String content) {
            this.content = content;
            return this;
        }

        public ConfigDumpEventBuilder type(String type) {
            this.type = type;
            return this;
        }

        public ConfigDumpEventBuilder lastModifiedTs(long lastModifiedTs) {
            this.lastModifiedTs = lastModifiedTs;
            return this;
        }

        /**
         * 构建配置保存时间
         *
         * @return ConfigDumpEvent object instance.
         */
        public ConfigDumpEvent build() {
            ConfigDumpEvent configDumpEvent = new ConfigDumpEvent();
            configDumpEvent.setRemove(remove);
            configDumpEvent.setNamespaceId(namespaceId);
            configDumpEvent.setDataId(dataId);
            configDumpEvent.setGroup(group);
            configDumpEvent.setContent(content);
            configDumpEvent.setType(type);
            configDumpEvent.setLastModifiedTs(lastModifiedTs);
            return configDumpEvent;
        }
    }
}
